package com.neu.service;

import com.neu.dao.CommodityDao;
import com.neu.pojo.Commodity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class CommodityServiceImpl implements CommodityService {
    @Autowired
    private CommodityDao commodityDao;

    @Override
    public int delCommodity(String commodity) {
        return commodityDao.delCommodity(commodity);
    }

    @Override
    public int addCommodity(Commodity commodity) {
        return commodityDao.addCommodity(commodity);
    }

    @Override
    public List<Commodity> getCommodityByPage(int page, int limit) {
        return commodityDao.getCommodityByPage((page-1)*limit,limit);
    }

    @Override
    public int getCommodityCount() {
        return commodityDao.getCommodityCount();
    }

    @Override
    public int updateCommodity(Commodity commodity) {
        return commodityDao.updateCommodity(commodity);
    }
}
